<?php

namespace Core;

/**
 * Description of Widget
 *
 * @author lxc
 */
class Widget
{

	public $assign = [];
	protected $obj = null;

	/**
	 * 模板赋值
	 * @param type $name
	 * @param type $value
	 * @return $this
	 */
	public function _assign($name, $value)
	{
		$this->assign[$name] = $value;
		return $this;
	}

	public function _display($template)
	{
		$template_file = APP_PATH . '/App/View/' . $template . '.html';
		if (!is_file($template_file))
			$this->_error('页面错误', 502);
		else {
			ob_start();
			extract($this->assign);
			include $template_file;
			return ob_get_clean();
		}
	}

}
